import { useSelector,useDispatch } from "react-redux";
import { Link } from "react-router";
function ReduxDemo(){
 

   let token=  useSelector((state:any)=>state.token);
   const dispatch= useDispatch();

   const update=()=>{

      dispatch({type:"UPDATE_TOKEN",data:"1234567890"})

   }

   console.log(token);
   

    return (
        <div>
            <div>ReduxDemo</div>
            <button onClick={()=>{update()}}>修改</button>
            <div>
                {token}
            </div>
            <Link to="/redux2">redux2</Link>
        </div>
    )

}
export default ReduxDemo;